package com.zy.server.controller;


import com.zy.dto.UserDto;
import com.zy.server.service.UserService;
import com.zy.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 张鑫
 * @since 2020-11-27
 */
@RestController
@RequestMapping("/api/user")
public class UserController {

    @Autowired
    private UserService userService;

    //登录
    @PostMapping("/login.do")
    public R login(@RequestBody UserDto userDto) {
        return userService.login(userDto);
    }

    // 注册
    @PostMapping("/register.do")
    public R register(@RequestBody UserDto userDto) {
        return userService.register(userDto);
    }

    // 校验手机号
    @GetMapping("/checkphone.do")
    public R check(String phone) {
        return userService.checkPhone(phone);
    }



}
